/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cm.java.jpa.inicial.test;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import org.junit.After;
import org.junit.Before;

/**
 *
 * @author escm
 */
public class EnderecoTesteIntegrado {
          private static EntityManagerFactory emf  = 
           Persistence.createEntityManagerFactory("cmJavaJPATeste");

    private EntityManager em;
    private EntityTransaction tx;

    
    @Before
    public void iniciaGerenciadorEntidades() throws Exception {
        em = emf.createEntityManager();
        tx = em.getTransaction();
    }

    @After
    public void encerraGerenciadorEntidades() throws Exception {
        if (em != null) {
            em.close();
        }
    }
}
